﻿@model abc.Models.ContactInformation
@{
    ViewBag.Title = "EditContactInformation";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="col-md-12">
<div class="box box-info">
    <div class="box-header with-border">
        <h3 class="box-title">Quick Example</h3>
    </div>
      <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
            </div><!-- /.box-header -->
    <!-- form start -->
@{
    using (@Html.BeginForm("SaveContactInformation","RecruitmentZone", FormMethod.Post, new { @class = "form-horizontal" }))
    {


        <div class="box-body">


            <div class="form-group">
                <label for="state" class="col-sm-3 control-label">State</label>
                <div class="col-sm-9">
                    <input type="hidden" name="ContactInformation_Id" id="ContactInformation_Id" value="@Model.ContactInformation_Id" />
                    @Html.DropDownListFor(d => d.ContactInformation_StateId, (List<SelectListItem>)ViewBag.GetAllStates, new { @class = "form-control",@id="GetStateDropdownData" })

                    <br />
                    @*<input type="button" class="btn btn-primary btn-lg " name="name" value="Submit " />*@

                </div>
            </div>
   
            <div class="form-group">
                <label for="City" class="col-sm-3 control-label">City</label>
                <div class="col-sm-9">
                    
                    @Html.DropDownListFor(d => d.ContactInformation_CityId,new SelectList(Enumerable.Empty<SelectListItem>(),"ContactInformation_CityId","City.City_Name"),@Model.City.City_Name,new{@class="form-control",@id="GetCityDropDownData"})
                                       <br />
                    @*<input type="button" class="btn btn-primary btn-lg " name="name" value="Submit " />*
                </div>
            </div>


            <div class="form-group">
                <label for="Address" class="col-sm-3 control-label">Address</label>
                <div class="col-sm-9">
                    @Html.TextAreaFor(m => m.ContactInformation_Address, new { @placeholder = "Address", @class = "form-control" })
                    @*<textarea class="form-control"  placeholder="Address"></textarea>*@
                </div>
            </div>
            <div class="form-group">
                <label for="Mobile" class="col-sm-3 control-label">Mobile</label>
                <div class="col-sm-9">
                    @Html.TextBoxFor(d => d.ContactInformation_MobileNo, new { @placeholder = "Mobile No", @class = "form-control" })
                    @*<input type="text" class="form-control" value="@Model.ContactInformation_MobileNo" name="name" placeholder="Mobile" />*@
                </div>
            </div>

            <div class="form-group">
                <label for="Mobile" class="col-sm-3 control-label">Alternate Mobile</label>
                <div class="col-sm-9">
                    @Html.TextBoxFor(d => d.ContactInformation_AlternateMobileNo, new { @placeholder = "Alternate Mobile No", @class = "form-control" })
                    @*<input type="text" value="@Model.ContactInformation_AlternateMobileNo" class="form-control" placeholder="Alternate Mobile" />*@
                </div>
            </div>
            <div class="form-group">
                <label for="Email" class="col-sm-3 control-label">E-mail</label>
                <div class="col-sm-9">
                    @Html.TextBoxFor(d => d.ContactInformation_EmailId, new { @placeholder = "EmailId", @class = "form-control" })
                    @*<input type="text" value="@Model.ContactInformation_EmailId"class="form-control" placeholder="E-mail" />*@
                </div>
            </div>

        </div>
        <div class="box-footer clearfix">
            <button type="submit" class="btn btn-sm btn-info btn-flat pull-left" data-toggle="modal" data-target="#call-CI">Update Contact Info</button>
            <a href="#" class="btn btn-sm btn-default btn-flat pull-right">Cancel</a>
        </div>
    }
}   
</div>

</div>
@section scripts
{<script>
    $(document).ready(function () {
        var Id = $("#ContactInformation_Id").val();
        if ($("#GetStateDropdownData").val() != 0) {
            var Sid = $("#GetStateDropdownData").val();
            $.getJSON("/RecruitmentZone/LoadCityByState", { StateId: Sid},
                   function (data) {
                       var select = $("#GetCityDropDownData");

                       $.each(data, function (index, CityData) {
                           select.append($('<option/>', {
                               value: CityData.Value,
                               text: CityData.Text

                           }));
                       });
                   });
            $("#CityDropDownData").val($("ContactInformation_Id").val());
        }
        $("#GetStateDropdownData").on('change', function () {
            var Sid = $(this).val();

            $.getJSON("/RecruitmentZone/LoadCityByState", { StateId: Sid },
                   function (data) {
                       var select = $("#GetCityDropDownData");
                       select.empty();
                       select.append($('<option/>', {
                           value: 0,
                           text: "-Please Select-"
                       }));
                       $.each(data, function (index, CityData) {
                           select.append($('<option/>', {
                               value: CityData.Value,
                               text: CityData.Text
                           }));
                       });
                   });
        });

    });
</script>




  
}
